package cn.geminis.warehouse.service.inventory.entity;

import cn.geminis.lowcode.annotation.CrudController;
import cn.geminis.lowcode.annotation.CrudRepository;
import cn.geminis.lowcode.annotation.QueryFilter;
import cn.geminis.lowcode.annotation.UuidEntity;
import cn.geminis.warehouse.service.basic.entity.ProductBatch;
import cn.geminis.warehouse.service.basic.entity.Warehouse;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import jakarta.persistence.Column;
import jakarta.persistence.ManyToOne;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 盘点明细
 */
@Getter
@Setter
@UuidEntity
@QueryFilter
@CrudRepository
@CrudController
public class InventoryDetail {

    @ManyToOne(optional = false)
    @JsonIgnoreProperties
    private Inventory inventory;

    /**
     * 商品批次
     */
    @ManyToOne(optional = false)
    private ProductBatch productBatch;

    /**
     * 货架
     */
    @ManyToOne(optional = false)
    private Warehouse warehouse;

    /**
     * 货架行
     */
    @Column(nullable = false)
    private int positionX;

    /**
     * 货架列
     */
    @Column(nullable = false)
    private int positionY;

    /**
     * 货架层
     */
    @Column(nullable = false)
    private int positionZ;

    /**
     * 应盘数量
     */
    @Column(nullable = false)
    private int amount;

    /**
     * 盘点人
     */
    @Column
    private String username;

    /**
     * 盘点时间
     */
    @Column
    private LocalDateTime time;

    /**
     * 备注
     */
    @Column(length = 2048)
    private String memo;

    /**
     * 状态
     */
    @Column(nullable = false)
    private String status;

}
